home *** CD-ROM | disk | FTP | other *** search
- /* Mini clone of the Unix chgrp command. */
-
- #include <sys/types.h>
- #include <unistd.h>
- #include <grp.h>
- #include <stdio.h>
-
- void usage (void);
-
- int main (int argc, char *argv[])
- {
- struct group *grp;
- unsigned long i;
-
- /* Must supply group name and at least one file/drawer name. */
- if (argc <= 2)
- {
- usage ();
- return (5);
- }
-
- if (!((grp = getgrnam (argv[1]))))
- {
- usage ();
- return (5);
- }
-
- for (i = 1; i < argc; i ++)
- {
- chown (argv[i], (uid_t) -1, grp->gr_gid);
- }
- return (0);
- }
-
- void usage (void)
- {
- puts ("Usage: minichgrp groupid file ...");
- }
-